﻿

@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Forwarding</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="~/Areas/Forwarding/Contents/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Areas/Forwarding/Contents/css/font-awesome.min.css" rel="stylesheet" />
    <link href="~/Areas/Forwarding/Contents/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
    <style>
        #tbEtrust tr td,#tbEtrust tr th{
           width:6.666%;
           text-align:center!important;
        }
        #tbCarriage tr td,#tbCarriage tr th{
           width:10%;
           text-align:center!important;
        }
         #tbExpense tr td,#tbExpense tr th{
           width:20%;
           text-align:center!important;
        }
         #l tr td,#l tr th{
            width:10%;
           text-align:center!important;
        }
        #tbCharge tr td,#tbCharge tr th{
           width:11.111%;
           text-align:center!important;
        }
        .gotoPageInput {
           width:70%!important;
           margin-left:15%!important
        }
        #tbExpense_pt_outTab {
          width:100%!important;
        }
    </style>
</head>
<body class="gray-bg" style="font-family:华文行楷">
    <!-- 页面 -->
    <div class="wrapper wrapper-content animated fadeInRight">
        <!-- 委托单 -->
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    @*list*@
                    <div class="ibox-title">
                        <h5>委托单</h5>
                        <div class="ibox-tools">
                            @*<a aria-expanded="false">
                                <i class="glyphicon glyphicon-search"></i>
                            </a>*@
                            <a aria-expanded="false" data-toggle="modal" data-target="#BasicsInformation" onclick="Close()" id="Insert">
                                <i class="glyphicon glyphicon-plus"></i>
                            </a>
                            <a aria-expanded="false" onclick="Close()" id="Update">
                                <i class="glyphicon glyphicon glyphicon-minus"></i>
                            </a>
                            <a class="collapse-link" aria-expanded="false" id="Delete">
                                <i class="glyphicon glyphicon-trash"></i>
                            </a>
                            <a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
                                <i class="glyphicon glyphicon-list-alt"></i>
                            </a>
                            <ul class="dropdown-menu dropdown-user">
                                <li>
                                    <a onclick="Audit()">审核</a>
                                </li>
                                <li>
                                    <a onclick="Copy()">复制</a>
                                </li>
                                <li>
                                    <a onclick="Print()">打印</a>
                                </li>
                                @*<li>
                                    <a>导入</a>
                                </li>*@
                                <li>
                                    <a onclick="EtrustDerive()">导出</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                    @*Select*@
                    <div class="ibox-content">
                        <form class="form-horizontal" role="form" id="Search" action="" method="post"> 
                            <div class="col-sm-12">
                                <div class="form-group">
                                    <div class="col-sm-3">
                                        <label class="col-sm-3 control-label">委托单号:</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="layui-input" placeholder="" name="EtrustNmber" oninput="Search()">
                                        </div>
                                    </div>
                                    <div class="col-sm-3">
                                        <label class="col-sm-3 control-label">柜号:</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="layui-input" placeholder="" name="Cupboard" oninput="Search()">
                                        </div>
                                    </div>
                                    <div class="col-sm-3">
                                        <label class="col-sm-3 control-label">封条号:</label>
                                        <div class="col-sm-9">
                                            <input type="text" class="layui-input" placeholder="" name="Seal" oninput="Search()">
                                        </div>
                                    </div>
                                    <div class="col-sm-3">
                                        <label class="col-sm-3 control-label">到厂时间:</label>
                                        <div class="col-sm-9">
                                            <input class="layui-input" id="test1-1" placeholder="yyyy-MM-dd HH:mm:ss" type="text"  name="ArriveTime" onclick="Laydate()" oninput="Search()">
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-sm-3">
                                        <label class="col-sm-3 control-label">客户简称:</label>
                                        <div class="col-sm-9">
                                            <select type="text" class="layui-input" id="ClientAbbreviationa" onchange="Search()" name="ClientAbbreviation"></select>
                                        </div>
                                    </div>
                                    <div class="col-sm-3">
                                        <label class="col-sm-3 control-label">提柜地点:</label>
                                        <div class="col-sm-9">
                                            <select type="text" class="layui-input" id="TiGuiDiDiana" onchange="Search()" name="TiGuiDiDianID"></select>
                                        </div>
                                    </div>
                                    <div class="col-sm-3">
                                        <label class="col-sm-3 control-label">还柜地点:</label>
                                        <div class="col-sm-9">
                                            <select type="text" class="layui-input" id="HuaiGuiDiDiana" onchange="Search()" name="HuaiGuiDiDianID"></select>
                                        </div>
                                    </div>
                                    <div class="col-sm-3">
                                        <label class="col-sm-3 control-label">至:</label>
                                        <div class="col-sm-9">
                                            <input class="layui-input" id="test1-2" placeholder="yyyy-MM-dd HH:mm:ss" type="text"  name="ArriveTimes" onclick="Laydate()" oninput="Search()" onchange="Search()">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>
                    @*table*@
                    <div class="ibox-content">
                        <table class="table table-striped table-bordered table-hover dataTables-example" id="tbEtrust">
                            <thead>
                                <tr>
                                    <th w_check="true" w_index="EtrustID">选择</th>
                                    <th w_index="EtrustType">状态</th>
                                    <th w_index="EtrustNmber">委托单号</th>
                                    <th w_index="WorkCategory">作业类别</th>
                                    <th w_index="CheXing">车型</th>
                                    <th w_index="arriveTimes">到厂时间</th>
                                    <th w_index="ClientAbbreviation">客户简称</th>
                                    <th w_index="contactsName">客户联系人</th>
                                    <th w_index="contactsPhone">客户联系人电话</th>
                                    <th w_index="ContactsName">工厂联系人</th>
                                    <th w_index="ContactsPhone">工厂联系电话</th>
                                    <th w_index="CabinetType">箱型</th>
                                    <th w_index="BookingSpace">订舱号S/0</th>
                                    <th w_index="Seal">封条号</th>
                                    <th w_index="HangCi">航次</th>
                                    <th w_index="AuditType" w_hidden="true">审核状态</th>
                                    <th w_index="EtrustID"  w_hidden="true">EtrustID</th>
                                    <th w_index="Staff" w_hidden="true">StaffName</th>
                                    <th w_index="OfferDetailID" w_hidden="true">OfferDetailID</th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <!-- 运输单 && 费用项目-->
        <div class="row">
            @*运输单*@
            <div class="col-sm-6">
                <div class="ibox float-e-margins">
                    @*list*@
                    <div class="ibox-title">
                        <h5>运输单</h5>
                        <div class="ibox-tools">
                            <a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
                                <i class="glyphicon glyphicon-list-alt"></i>
                            </a>
                            <ul class="dropdown-menu dropdown-user">
                                <li>
                                    <a onclick="SendCar()">派车</a>
                                </li>
                                <li>
                                    <a onclick="Follow()">跟单</a>
                                </li>
                                <li>
                                    <a onclick="EtrustPrint()">打印报表</a>
                                </li>
                                <li>
                                    <a onclick="Prints()">打印</a>
                                </li>
                                <li>
                                    <a onclick="CarriageDerive()">导出</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                    @*table*@
                    <div class="ibox-content">
                        <table class="table table-striped table-bordered table-hover dataTables-example" id="tbCarriage">
                            <thead>
                                <tr>
                                    <th w_check="true" w_index="EtrustID">选择</th>
                                    <th w_index="EtrustNmber">委托单号</th>
                                    <th w_index="CarriageNumber">运输单号</th>
                                    <th w_index="EtrustType">状态</th>
                                    <th w_index="ClientAbbreviation">客户简称</th>
                                    <th w_index="CheXing">车型</th>
                                    <th w_index="Undertake">承运公司</th>
                                    <th w_index="ChauffeurName">司机姓名</th>
                                    <th w_index="BracketCode">托架代码</th>
                                    <th w_index="VehicleCode">车辆代码</th>
                                    <th w_index="AuditType" w_hidden="true">审核状态</th>
                                    <th w_index="EtrustID" w_hidden="true">EtrustID</th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
            @*费用项目*@
            <div class="col-sm-6">
                <div class="ibox float-e-margins">
                    @*list*@
                    <div class="ibox-title">
                        <h5>费用项目</h5>
                        <div class="ibox-tools">
                            <a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true">
                                <i class="glyphicon glyphicon-list-alt"></i>
                            </a>
                            <ul class="dropdown-menu dropdown-user">
                                <li>
                                    <a onclick="SF()">应收应付</a>
                                </li>
                                <li>
                                    <a onclick="Printn()">打印</a>
                                </li>
                                <li>
                                    <a onclick="ChagreDerive()">导出</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                    @*table*@
                    <div class="ibox-content">
                        <table class="table table-striped table-bordered table-hover dataTables-example" id="tbCharge">
                            <thead>
                                <tr>
                                    <th w_index="ChargeID" w_check="true" w_hidden="true">选择</th>
                                    <th w_index="ExpenseName">费用名称</th>
                                    <th w_index="SettleAccounts">收付款类型</th>
                                    <th w_index="Reckoning">结算单位</th>
                                    <th w_index="UnitPrice">单价</th>
                                    <th w_index="CabinetType">箱型</th>
                                    <th w_index="BoxQuantity">箱量</th>
                                    <th w_index="UnitPrice">金额</th>
                                    <th w_index="Currency">币种</th>
                                    <th w_index="AuditType" w_hidden="true">审核状态</th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 新增委托单 -->
    <div class="modal fade" id="BasicsInformation" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="overflow:auto!important">
        <div class="modal-dialog" style="width:90%">
            <div class="modal-content col-sm-12">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" style="font-size:25px!important">新增委托单</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form" id="Etrust" action="/Forwarding/Forwarding/InsertEtrust" method="post">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">委托单号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="EtrustNmber" id="EtrustNmber" readonly  >
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">作业类别:</label>
                                    <div class="col-sm-8">
                                        <select type="text" class="layui-input" placeholder="WorkCategory" name="WorkCategory">
                                            <option value="出口柜">出口柜</option>
                                            <option value="进口柜">进口柜</option>
                                            <option value="仓库柜">仓库柜</option>
                                            <option value="渡空柜">内陆柜</option>
                                            <option value="内陆柜">内陆柜</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">车型:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="自备柜" name="CheXing" readonly value="自备柜">
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">货物分类:</label>
                                    <div class="col-sm-8">
                                        <select type="text" class="layui-input" placeholder="" name="CargoClassify">
                                            <option value="">CargoClassify</option>
                                            <option value="氨纶">氨纶</option>
                                            <option value="聚烯烃类纤维">聚烯烃类纤维</option>
                                            <option value="聚酰氨类纤维">聚酰氨类纤维</option>
                                            <option value="聚酯类纤维">聚酯类纤维</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">客户代码:</label>
                                    <div class="col-sm-7">
                                        <select type="text" class="layui-input" placeholder="" name="ClientID" id="ClientCode"></select>
                                    </div>
                                    <i class="glyphicon glyphicon-plus" style="line-height:32px;cursor:pointer" data-toggle="modal" data-target="#Client" onclick="Close('Client')"></i>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">客户全称:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ChineseName" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">电话:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ClientMobile" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">业务员:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="StaffName" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">联系人:</label>
                                    <div class="col-sm-7">
                                        <select type="text" class="layui-input" placeholder="" name="ClientScontactsID" id="ClientScontactsID">
                                            <option value="0">ClientScontacts</option>
                                        </select>
                                    </div>
                                    <i class="glyphicon glyphicon-plus" style="line-height:32px;cursor:pointer" onclick="Close('ClientScontacts')" id="Scontacts"></i>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">计划装卸时间:</label>
                                    <div class="col-sm-8">
                                        <input class="layui-input " id="test1-3" placeholder="yyyy-MM-dd HH:mm:ss" type="text" name="PlanHandTime">
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">代收比例:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="CollectionMoney" onchange="Float(CollectionMoney,0,30)" maxlength="5">
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">所属组织:</label>
                                    <div class="col-sm-8">
                                        <select type="text" class="layui-input" placeholder="" name="MessageID" id="MessageID"></select>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">工厂代码:</label>
                                    <div class="col-sm-7">
                                        <select type="text" class="layui-input" placeholder="" name="ClientSiteID" id="ClientSiteID"></select>
                                    </div>
                                    <i class="glyphicon glyphicon-plus" style="line-height:32px;cursor:pointer" onclick="Close('ClientScontacts')" id="Factory"></i>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">工厂名称:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="FactoryName" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">货主名称:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="HuoZhuName" onchange="Name(HuoZhuName)">
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">订单号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" id="IndentNumber" name="IndentNumber" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">地址:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ClientSite" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">工厂区域:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="GatedotName" readonly >
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">联系人:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ContactsName" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">电话:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ContactsPhone" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">提柜地点:</label>
                                    <div class="col-sm-8">
                                        <select type="text" class="layui-input" placeholder="" name="TiGuiDiDianID" id="TiGuiDiDianID"></select>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">区域:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="T" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">还柜地点:</label>
                                    <div class="col-sm-8">
                                        <select type="text" class="layui-input" placeholder="" name="HuaiGuiDiDianID" id="HuaiGuiDiDianID"></select>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">区域:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="H" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">船名:</label>
                                    <div class="col-sm-8">
                                        <select type="text" class="layui-input" placeholder="" name="ShipID" id="ShipID"></select>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">船公司:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Chuangs" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">航次:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="HangCi" id="HangCi" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">回场时间:</label>
                                    <div class="col-sm-8">
                                        <input class="layui-input " id="test1-4" placeholder="yyyy-MM-dd HH:mm:ss" type="text" name="HuiChangTime">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">进出口岸:</label>
                                    <div class="col-sm-7">
                                        <select type="text" class="layui-input" placeholder="" name="PortID" id="PortID"></select>
                                    </div>
                                    <i class="glyphicon glyphicon-plus" style="line-height:32px;cursor:pointer"  data-toggle="modal" data-target="#Port"  onclick="Close('Port')"></i>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">目的港:</label>
                                    <div class="col-sm-8">
                                        <select type="text" class="layui-input" placeholder="" name="GoalHarborID" id="GoalHarborID"></select>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">税金比例:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ShuiBl" onchange="Float(ShuiBl,0,30)" maxlength="5">
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">管理费比例:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ManagementFee" onchange="Float(ManagementFee, 0, 30)" maxlength="5">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">辅助业务:</label>
                                    <div class="col-sm-8">
                                        <select type="text" class="layui-input" placeholder="" name="AssistBusiness">
                                            <option value="">AssistBusiness</option>
                                            <option value="企业管理服务">企业管理服务</option>
                                            <option value="经纪代理服务">经纪代理服务</option>
                                            <option value="人力资源服务">人力资源服务</option>
                                            <option value="安全保护服务">安全保护服务</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">货物重量(T):</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="CargoWeight"  onchange="Float(CargoWeight)">
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">开舱时间:</label>
                                    <div class="col-sm-8">
                                        <input class="layui-input " id="test1-5" placeholder="yyyy-MM-dd HH:mm:ss" type="text" name="KaiCangTime">
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">到厂时间:</label>
                                    <div class="col-sm-8">
                                        <input class="layui-input " id="test1-6" placeholder="yyyy-MM-dd HH:mm:ss" type="text" name="ArriveTime">
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-12">
                                    <label class="col-sm-1 control-label">特殊需要:</label>
                                    <div class="col-sm-11" style="padding-left:8px">
                                        <textarea style="width:100%;height:100px" class="layui-input" name="SpecialNeed"></textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-12">
                                    <label class="col-sm-1 control-label">注意事项:</label>
                                    <div class="col-sm-11" style="padding-left:8px">
                                        <textarea style="width:100%;height:100px" class="layui-input" name="AttentionMatter"></textarea>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <table class="table table-striped table-bordered table-hover dataTables-example" id="l">
                                    <thead>
                                        <tr>
                                            @*<th>选择</th>*@
                                            <th>柜型</th>
                                            <th>提柜地点</th>
                                            <th>提柜区域</th>
                                            <th>还柜地点</th>
                                            <th>还柜区域</th>
                                            <th>订舱号S/0</th>
                                            <th>柜号</th>
                                            <th>封条号</th>
                                            <th>车型</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td style="text-align: center;display:none" class="lineNoWrap" ><input class="bsgrid_editgrid_check" type="checkbox" value="true" ></td>
                                            <td style="text-align: center;" class="lineNoWrap">
                                                <select type="text" class="layui-input"  name="CabinetType">
                                                    <option value="">CabinetType</option>
                                                    <option value="20GP">20GP</option>
                                                    <option value="40GP">40GP</option>
                                                    <option value="60GP">60GP</option>
                                                    <option value="80GP">80GP</option>
                                                    <option value="100GP">100GP</option>
                                                </select>
                                            </td>
                                            <td style="text-align: center;" class="lineNoWrap"></td>
                                            <td style="text-align: center;" class="lineNoWrap"></td>
                                            <td style="text-align: center;" class="lineNoWrap"></td>
                                            <td style="text-align: center;" class="lineNoWrap"></td>
                                            <td style="text-align: center;" class="lineNoWrap"></td>
                                            <td style="text-align: center;" class="lineNoWrap"></td>
                                            <td style="text-align: center;" class="lineNoWrap"></td>
                                            <td style="text-align: center;" class="lineNoWrap">自备柜</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer col-sm-12" style="margin-bottom:70px">
                    <button type="button" class="btn btn-primary"  id="etrust"><span class="fa fa-check"></span>确定</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal"><span class="fa fa-close"></span>关闭</button>
                </div>
            </div>
        </div>
    </div>
    <!-- 新增客户 -->
    <div class="modal fade" id="Client" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content col-sm-12">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" style="font-size:20px">新增客户</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form" id="InsertClient" action="InsertClient" method="post">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">客户简称:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="ClientAbbreviation" onchange="Name(ClientAbbreviation)" maxlength="10">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">客户代码:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="ClientCode" maxlength="10" onchange="English(ClientCode)">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">中文名称:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="ChineseName" onchange="Name(ChineseName)" maxlength="20">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">所属机构:</label>
                                <div class="col-sm-8">
                                    <select type="text" class="layui-input" placeholder="" name="MessageID" id="Message"></select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">描述:</label>
                                <div class="col-sm-8">
                                    <textarea type="text" class="layui-input" placeholder="" name="Describe" style="height:100px" maxlength="50"></textarea>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-sm-8 control-label">委托单位:</label>
                                    <div class="col-sm-4 checkbox checkbox-primary">
                                        <input type="checkbox" value="true" name="WTDW">
                                        <label></label>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-8 control-label">发货人:</label>
                                    <div class="col-sm-4 checkbox checkbox-primary">
                                        <input type="checkbox" value="true" name="FHR">
                                        <label></label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-sm-8 control-label">船公司:</label>
                                    <div class="col-sm-4 checkbox checkbox-primary">
                                        <input type="checkbox" value="true" name="CGS">
                                        <label></label>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-8 control-label">合作代理:</label>
                                    <div class="col-sm-4 checkbox checkbox-primary">
                                        <input type="checkbox" value="true" name="HZDL">
                                        <label></label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-sm-8 control-label">收货人:</label>
                                    <div class="col-sm-4 checkbox checkbox-primary">
                                        <input type="checkbox" value="true" name="SHR">
                                        <label></label>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-8 control-label">拖车公司:</label>
                                    <div class="col-sm-4 checkbox checkbox-primary">
                                        <input type="checkbox" value="true" name="TCGS">
                                        <label></label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-sm-8 control-label">保险公司:</label>
                                    <div class="col-sm-4 checkbox checkbox-primary">
                                        <input type="checkbox" value="true"  name="BXGS">
                                        <label></label>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-8 control-label">船代公司:</label>
                                    <div class="col-sm-4 checkbox checkbox-primary">
                                        <input type="checkbox" value="true" name="CDGS">
                                        <label></label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-sm-8 control-label">通知人:</label>
                                    <div class="col-sm-4 checkbox checkbox-primary">
                                        <input type="checkbox" value="true" name="TZR">
                                        <label></label>
                                    </div>
                                </div>
                                <div class="col-sm-6">
                                    <label class="col-sm-8 control-label">物流公司:</label>
                                    <div class="col-sm-4 checkbox checkbox-primary">
                                        <input type="checkbox" value="true" name="WLGS">
                                        <label></label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-6">
                                    <label class="col-sm-8 control-label">报关行:</label>
                                    <div class="col-sm-4 checkbox checkbox-primary">
                                        <input type="checkbox" value="true" name="BGH">
                                        <label></label>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer col-sm-12">
                    <button type="button" class="btn btn-primary" id="insertclient"><span class="fa fa-check" ></span>确定</button>
                    @*<button type="button" class="btn btn-primary" id="" onclick="Close('Client')"><span class="glyphicon glyphicon-refresh" ></span>重置</button>*@
                    <button type="button" class="btn btn-primary" data-dismiss="modal"><span class="fa fa-close"></span>关闭</button>
                </div>
            </div>
        </div>
    </div>
    <!-- 新增客户联系人 -->
    <div class="modal fade" id="ClientScontacts" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content col-sm-12">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" style="font-size:20px">新增客户联系人</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form" id="InsertClientScontacts" action="" method="post">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">所属客户公司:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="Message" readonly>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">联系人名称:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="contactsName" onchange="Name(contactsName)" maxlength="10">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">联系人号码:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="contactsPhone" onchange="Phone(contactsPhone)" maxlength="18">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">备注:</label>
                                <div class="col-sm-8">
                                    <textarea type="text" class="layui-input" placeholder="" name="" style="height:100px" maxlength="50"></textarea>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer col-sm-12">
                    <button type="button" class="btn btn-primary" id="insertclientscontacts"><span class="fa fa-check" ></span>确定</button>
                    @*<button type="button" class="btn btn-primary" id=""  onclick="Close('ClientScontacts')"><span class="glyphicon glyphicon-refresh" ></span>重置</button>*@
                    <button type="button" class="btn btn-primary" data-dismiss="modal"><span class="fa fa-close"></span>关闭</button>
                </div>
            </div>
        </div>
    </div>
    <!-- 新增客户地址 -->
    <div class="modal fade" id="ClientSite" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content col-sm-12">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" style="font-size:20px!important">新增客户地址</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form" id="InsertClientSite" action="" method="post">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">所属客户公司:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="Message" readonly>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">工厂名称:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="FactoryName" onchange="Name(FactoryName)" maxlength="10">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">工厂代码:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="FactoryCode" onchange="FactoryCode" maxlength="10">
                                </div>
                            </div>
                           <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">所属省份:</label>
                                <div class="col-sm-8">
                                    <select type="text" class="layui-input" placeholder="" name="Province" id="Province">
                                        <option value="">Province</option>
                                        <option value="安徽省">安徽省</option>
                                        <option value="北京省">北京省</option>
                                        <option value="重庆省">重庆省</option>
                                        <option value="福建省">福建省</option>
                                        <option value="贵州省">贵州省</option>
                                        <option value="广东省">广东省</option>
                                        <option value="甘肃省">甘肃省</option>
                                        <option value="黑龙江">黑龙江</option>
                                        <option value="河北省">河北省</option>
                                        <option value="河南省">河南省</option>
                                        <option value="湖北省">湖北省</option>
                                        <option value="湖南省">湖南省</option>
                                        <option value="海南省">海南省</option>
                                        <option value="吉林省">吉林省</option>
                                        <option value="江苏省">江苏省</option>
                                        <option value="江西省">江西省</option>
                                        <option value="辽宁省">辽宁省</option>
                                        <option value="青海省">青海省</option>
                                        <option value="山西省">山西省</option>
                                        <option value="山东省">山东省</option>
                                        <option value="四川省">四川省</option>
                                        <option value="上海省">上海省</option>
                                        <option value="台湾省">台湾省</option>
                                        <option value="天津省">天津省</option>
                                        <option value="陕西省">陕西省</option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">所属城市:</label>
                                <div class="col-sm-8">
                                    <select type="text" class="layui-input" placeholder="" name="CityID" id="CityID" ></select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">所属区域:</label>
                                <div class="col-sm-8">
                                    <select type="text" class="layui-input" placeholder="" name="GatedotID" id="GatedotID"></select>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">详细地址:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="ClientSite" maxlength="20">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">联系人:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="ContactsName" maxlength="10" onchange="Name(ContactsName)">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">联系电话:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="ContactsPhone" onchange="Phone(ContactsPhone)" maxlength="11">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">备注:</label>
                                <div class="col-sm-8">
                                    <textarea type="text" class="layui-input" placeholder="" name="Remark" style="height:100px" maxlength="50"></textarea>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer col-sm-12">
                    <button type="button" class="btn btn-primary" id="insertclientsite"><span class="fa fa-check" ></span>确定</button>
                    @*<button type="button" class="btn btn-primary" id="" onclick="Close('ClientSite')"><span class="glyphicon glyphicon-refresh" ></span>重置</button>*@
                    <button type="button" class="btn btn-primary" data-dismiss="modal"><span class="fa fa-close"></span>关闭</button>
                </div>
            </div>
        </div>
    </div>
    <!-- 新增港口 -->
    <div class="modal fade" id="Port" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content col-sm-12">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" style="font-size:20px!important">新增港口</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form" id="InsertPort" action="InsertPort" method="post">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">中文名称:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="ChineseName" onchange="Name(ChineseName)" maxlength="10">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">港口代码:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="PortCode" onchange="English(PortCode)" maxlength="10">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">英文名称:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="EnglishName" onchange="Englishning(EnglishName)" maxlength="20">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">国家代码:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="CountryCode" onchange="English(CountryCode)" maxlength="10"/>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">区域:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="Area"  maxlength="10">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">联系电话:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="Phones" onchange="Phone(Phones)" maxlength="11">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">泊位数:</label>
                                <div class="col-sm-8">
                                    <input type="text" class="layui-input" placeholder="" name="Berthage" onchange="Number(Berthage)" maxlength="2">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">备注:</label>
                                <div class="col-sm-8">
                                    <textarea type="text" class="layui-input" placeholder="" name="Remark" style="height:100px" maxlength="50"></textarea>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer col-sm-12">
                    <button type="button" class="btn btn-primary" id="insertport"><span class="fa fa-check"></span>确定</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal"><span class="fa fa-close"></span>关闭</button>
                </div>
            </div>
        </div>
    </div>
    <!-- 新增派车 -->
    <div class="modal fade" id="InsertSendCar" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="overflow:auto!important">
        <div class="modal-dialog" style="width:90%">
            <div class="modal-content col-sm-12">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" style="font-size:25px!important">新增派车</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form" id="SendCar" action="/Forwarding/Forwarding/InsertSendCar" method="post">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">承运公司:</label>
                                    <div class="col-sm-8">
                                        <select type="text" class="layui-input" placeholder="" name="UndertakeID" id="UndertakeID"></select>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">运输单号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="CarriageNumber" readonly> 
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">客户简称:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ClientAbbreviation" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">工厂简称:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="FactoryName" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">作业类别:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="WorkCategory" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">船公司:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Chuangs" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">柜型:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="CheXing" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">运输路线:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="YSLX" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">柜号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Cupboard" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">封条号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Seal" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">订舱号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="BookingSpace" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">派车单号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="OddNumber" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">车牌号:</label>
                                    <div class="col-sm-8">
                                        <select type="text" class="layui-input" placeholder="" name="VehicleInformationID" id="VehicleInformationID"></select>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">托架编号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="BracketCode" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">司机名称:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Shij" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">司机IC卡:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ICNumber" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">司机手机:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="PhoneOne" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">托架型号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="BracketType" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">到厂时间:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ArriveTime" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">派车日期:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="PaiCheDate"  id="test1-7">
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">派车说明:</label>
                                <div class="col-sm-11">
                                    <textarea type="text" class="layui-input" placeholder="" name="PaiCheExplain" style="height:100px" maxlength="50"></textarea>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer col-sm-12">
                    <button type="button" class="btn btn-primary" id="insertsendcar"><span class="fa fa-check"></span>确定</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal"><span class="fa fa-close"></span>关闭</button>
                </div>
            </div>
        </div>
    </div>
    <!-- 新增跟单 -->
    <div class="modal fade" id="InsertFollow" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="overflow:auto!important">
        <div class="modal-dialog" style="width:90%">
            <div class="modal-content col-sm-12">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" style="font-size:25px!important">新增跟单</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form" id="Follow" action="/Forwarding/Forwarding/InsertFollow" method="post">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">承运公司:</label>
                                    <div class="col-sm-8">
                                        <select type="text" class="layui-input" placeholder="" name="UndertakeID" id="UndertakeIDs" disabled></select>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">运输单号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="CarriageNumber" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">客户简称:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ClientAbbreviation" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">工厂简称:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="FactoryName" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">作业类别:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="WorkCategory" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">船公司:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Chuangs" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">柜型:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="CheXing" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">运输路线:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="YSLX" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">柜号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Cupboard" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">封条号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Seal" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">订舱号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="BookingSpace" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">派车单号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="OddNumber" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">车牌号:</label>
                                    <div class="col-sm-8">
                                        <select type="text" class="layui-input" placeholder="" name="VehicleInformationID" id="VehicleInformationIDs" disabled></select>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">托架编号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="BracketCode" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">司机名称:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Shij" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">司机IC卡:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ICNumber" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">司机手机:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="PhoneOne" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">托架型号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="BracketType" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">到厂时间:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ArriveTime" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">派车日期:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="PaiCheDate" id="test1-8" disabled>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">派车时间:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="DispatchTime" id="test1-9" >
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">提空柜时间:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="TiKGuiTime" id="test1-10" >
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">到达工厂时间:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ArriveFactoryTime" id="test1-11" >
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">离开工厂时间:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="LeftFactoryTime" id="test1-12" >
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">还重柜时间:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="HuaiWeightTime" id="test1-13" >
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">跟单完成时间:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="FollowTime" id="test1-14">
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label">跟单说明:</label>
                                <div class="col-sm-11">
                                    <textarea type="text" class="layui-input" placeholder="" name="PaiCheExplain" style="height:100px" maxlength="50"></textarea>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer col-sm-12" >
                    <button type="button" class="btn btn-primary" id="insertfollow"><span class="fa fa-check"></span>确定</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal"><span class="fa fa-close"></span>关闭</button>
                </div>
            </div>
        </div>
    </div>
    <!-- 应收应付 -->
    <div class="modal fade" id="InsertSF" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="overflow:auto!important">
        <div class="modal-dialog" style="width:90%">
            <div class="modal-content col-sm-12">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" style="font-size:25px!important">应收应付</h4>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal" role="form" id="SF" action="/Forwarding/Forwarding/InsertSF" method="post">
                        <div class="col-sm-12">
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">派车日期:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="PaiCheDate" id="test1-8" disabled>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">运输单号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="CarriageNumber" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">客户简称:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ClientAbbreviation" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">工厂简称:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="FactoryName" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">作业类别:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="WorkCategory" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">船公司:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Chuangs" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">柜型:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="CheXing" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">运输路线:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="YSLX" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">柜号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Cupboard" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">封条号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Seal" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">订舱号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="BookingSpace" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">派车单号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="OddNumber" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">司机手机:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="PhoneOne" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">托架编号:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="BracketCode" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">司机名称:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="Shij" readonly>
                                    </div>
                                </div>
                                <div class="col-sm-3">
                                    <label class="col-sm-4 control-label">到厂时间:</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="layui-input" placeholder="" name="ArriveTime" readonly>
                                    </div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="col-sm-12">
                            <div class="form-group">
                                <table class="table table-striped table-bordered table-hover dataTables-example" id="tbExpense">
                                    <thead>
                                        <tr>
                                            <th w_index="ExpenseID" w_check="true">选择</th>
                                            <th w_index="SettleAccounts">收付款类型</th>
                                            <th w_index="ExpenseName  ">费用名称</th>
                                            <th w_index="CostAttributes">费用属性</th>z
                                            <th w_index="">单价</th>
                                            <th  w_render="YSF" w_hidden="true">单价</th>
                                        </tr>
                                    </thead>
                                </table>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer col-sm-12" style="margin-bottom:70px">
                    <button type="button" class="btn btn-primary" id="insertSF"><span class="fa fa-check"></span>确定</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal"><span class="fa fa-close"></span>关闭</button>
                </div>
            </div>
        </div>
    </div>
    <!-- Bootstrap -->
    <script src="~/Content/bootstrap-3.3.7-dist/js/jquery-2.0.3.min.js"></script>
    <script src="~/Content/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
    <!-- Bsgrid -->
    <script src="~/Content/jquery.bsgrid-1.37/builds/merged/bsgrid.all.min.js"></script>
    <script src="~/Content/jquery.bsgrid-1.37/builds/js/lang/grid.zh-CN.min.js"></script>
    <!-- 提交表单 -->
    <script src="~/Content/js/jquery.form.js"></script>
    <!-- 弹出框 -->
    <script src="~/Content/layer/layer.js"></script>
    <!-- layui -->
    <script src="~/Content/layui/layui.js"></script>
    <!-- 自定义js -->
    @*<script src="~/Areas/Forwarding/Contents/Custom.js"></script>*@
    <!-- 下拉框,点击行js -->
    <script src="~/Content/js/combobox.js"></script> 
    <!-- 自动回填 -->
    <script src="~/Content/js/customfunction.js"></script>
    <script>
        var Clinet
        var EtrustID
        var A = 0
        //页面加载
        $(function () {
            //表格绑定
            tbEtrust = $.fn.bsgrid.init('tbEtrust', {
                url: "/Forwarding/Forwarding/SelectEtrust?Carriage=" + true,
                pageSize: 5,
                autoLoad: true,
                pageSizeSelect: false,
                displayBlankRows: false,
                pagingLittleToolbar: false,
                pagingToolbarAlign: "right",
                event: {
                    customRowEvents: {
                        click: function (record, rowIndex, trObj, options) {
                            A = record.EtrustID;
                            Check("#tbEtrust tr", rowIndex + 1);
                            tbCarriage.search({ EtrustID: record.EtrustID })
                            tbCharge.search({ EtrustID: record.EtrustID })
                            EtrustID = record.EtrustID
                            setTimeout(function () {
                                Check("#tbCarriage tr", 1);
                            },100)
                        }
                    }
                }
            })
            tbCarriage = $.fn.bsgrid.init('tbCarriage', {
                url: "/Forwarding/Forwarding/SelectEtrust?Carriage=" + true + "&EtrustID=" + 0,
                pageSize: 5,
                autoLoad: true,
                pageSizeSelect: true,
                displayBlankRows: true,
                pagingLittleToolbar: false,
                pagingToolbarAlign: "right",
                event: {
                    customRowEvents: {
                        click: function (record, rowIndex, trObj, options) {
                            Check("#tbCarriage tr", rowIndex + 1);
                        }
                    }
                }
            })
            tbCharge = $.fn.bsgrid.init('tbCharge', {
                url: "/Forwarding/Forwarding/SelectEtrust?Carriage=" + false + "&EtrustID=" + 0,
                pageSize: 5,
                autoLoad: true,
                pageSizeSelect: true,
                displayBlankRows: true,
                pagingLittleToolbar: false,
                pagingToolbarAlign: "right",
                event: {
                    customRowEvents: {
                        click: function (record, rowIndex, trObj, options) {
                            Check("#tbCharge tr", rowIndex + 1);
                        }
                    }
                }
            })
            tbExpense = $.fn.bsgrid.init('tbExpense', {
                url: "/Forwarding/Forwarding/SelectExpense",
                pageSize: 10,
                autoLoad: true,
                pageSizeSelect: true,
                displayBlankRows: true,
                pagingLittleToolbar: false,
                event: {
                    customRowEvents: {
                        click: function (record, rowIndex, trObj, options) {
                            Check("#tbExpense tr", rowIndex + 1);
                        }
                    }
                }
            })
            //下拉框绑定
            appendOptions("ClientAbbreviationa", "/Forwarding/Forwarding/Client?ClientAbbreviation=" + 1, "ClientAbbreviation")
            appendOptions("TiGuiDiDiana", "/Forwarding/Forwarding/Mention", "TiGuiDiDian")
            appendOptions("HuaiGuiDiDiana", "/Forwarding/Forwarding/Mention", "HuaiGuiDiDian")
            appendOptions("TiGuiDiDianID", "/Forwarding/Forwarding/Mention", "TiGuiDiDian")
            appendOptions("HuaiGuiDiDianID", "/Forwarding/Forwarding/Mention", "HuaiGuiDiDian")
            appendOptions("ClientCode", "/Forwarding/Forwarding/Client?ClientID=" + 1, "ClientCode")
            appendOptions("MessageID", "/Main/Message", "Message")
            appendOptions("Message", "/Main/Message", "Message")
            appendOptions("ShipID", "/Forwarding/Forwarding/Ship", "Ship")
            appendOptions("PortID", "/Forwarding/Forwarding/Port", "Port")
            appendOptions("GoalHarborID", "/Forwarding/Forwarding/Port", "GoalHarbor")
            appendOptions("UndertakeID", "/Forwarding/Forwarding/SelectUndertake", "Undertake")
            appendOptions("UndertakeIDs", "/Forwarding/Forwarding/SelectUndertake", "Undertake")
            appendOptions("UndertakeIDl", "/Forwarding/Forwarding/SelectUndertake", "Undertake")
        });
        //查询
        function Search() {
            if ($("#Search [name='EtrustNmber']").val() == undefined || $("#Search [name='EtrustNmber']").val() == null) {
                $("#Search [name='EtrustNmber']").val() = "";
            }
            if ($("#Search [name='Cupboard']").val() == undefined || $("#Search [name='Cupboard']").val() == null) {
                $("#Search [name='Cupboard']").val() = "";
            }
            if ($("#Search [name='Seal']").val() == undefined || $("#Search [name='Seal']").val() == null) {
                $("#Search [name='Seal']").val() = "";
            }
            if ($("#Search [name='ArriveTime']").val() == undefined || $("#Search [name='ArriveTime']").val() == null) {
                $("#Search [name='ArriveTime']").val() = "";
            }
            if ($("#Search [name='ArriveTimes']").val() == undefined || $("#Search [name='ArriveTimes']").val() == null) {
                $("#Search [name='ArriveTimes']").val() = "";
            }
            if ($("#Search [name='ClientAbbreviation']").val() == undefined || $("#Search [name='ClientAbbreviation']").val() == null) {
                $("#Search [name='ClientAbbreviation']").val() = "";
            }
            tbEtrust.search({
                EtrustNmber: $("#Search [name='EtrustNmber']").val(),
                Cupboard: $("#Search [name='Cupboard']").val(),
                Seal: $("#Search [name='Seal']").val(),
                ArriveTime: $("#Search [name='ArriveTime']").val(),
                ArriveTimes: $("#Search [name='ArriveTimes']").val(),
                ClientAbbreviation: $("#Search [name='ClientAbbreviation']").val(),
                TiGuiDiDianID: $("#Search [name='TiGuiDiDianID']").val(),
                HuaiGuiDiDianID: $("#Search [name='HuaiGuiDiDianID']").val()
            });
            tbCarriage.search({ Carriage: true, EtrustID: 0 })
            tbCharge.search({ Carriage: false, EtrustID: 0 })
            EtrustID = null;
            A = 0;
        }
        //查询
        function Laydate() {
            $(".laydate-btns-clear").attr("onclick", 'Search()')
            $(".laydate-btns-now").attr("onclick", 'Search()')
            $(".laydate-btns-confirm").attr("onclick", 'Search()')
        }
        //下拉框改变触发
        $("#UndertakeID").change(function () {
            appendOptions("VehicleInformationID", "/Forwarding/Forwarding/SelectVehicleInformation?UndertakeID=" + $("#UndertakeID").val(), "VehicleInformation")
            $("#SendCar [name='BracketCode']").val("")
            $("#SendCar [name='Shij']").val("")
            $("#SendCar [name='ICNumber']").val("")
            $("#SendCar [name='PhoneOne']").val("")
            $("#SendCar [name='BracketType']").val("")
        })
        //下拉框改变触发
        $("#VehicleInformationID").change(function () {
            $.post("/Forwarding/Forwarding/SelectSendCar?VehicleInformationID=" + $("#VehicleInformationID").val(), function (Data) {
                if (Data.length>0) {
                    loadDatatoForm("SendCar", Data[0])
                } else {
                    $("#SendCar [name='BracketCode']").val("")
                    $("#SendCar [name='Shij']").val("")
                    $("#SendCar [name='ICNumber']").val("")
                    $("#SendCar [name='PhoneOne']").val("")
                    $("#SendCar [name='BracketType']").val("")
                }
            })
        })
        //下拉框改变触发
        $("#ClientCode").change(function () {
            appendOptions("ClientScontactsID", "/Forwarding/Forwarding/ClientScontacts?ClientID=" + $("#ClientCode").val(), "ClientScontacts")
            appendOptions("ClientSiteID", "/Forwarding/Forwarding/ClientSite?ClientID=" + $("#ClientCode").val(), "ClientSite")
            $.post("/Forwarding/Forwarding/SelectClient?ClientID=" + $("#ClientCode").val(), function (Data) {
                    $("#Etrust [name='ChineseName']").val(Data[0])
                    $("#Etrust [name='ClientMobile']").val("")
                    $("#Etrust [name='FactoryName']").val("")
                    $("#Etrust [name='ClientSite']").val("")
                    $("#Etrust [name='GatedotName']").val("")
                    $("#Etrust [name='ContactsName']").val("")
                    $("#Etrust [name='ContactsPhone']").val("")
                    Clinet = Data[0]
            })
        })
        //下拉框改变触发
        $("#Province").change(function () {
            appendOptions("CityID", "/Forwarding/Forwarding/SelectCity?Province=" + $("#Province").val())
            $("#GatedotID").val(0)
        })
        //下拉框改变触发
        $("#CityID").change(function () {
            appendOptions("GatedotID", "/Forwarding/Forwarding/SelectGatedot?CityID=" + $("#CityID").val())
        })
        //下拉框改变触发
        $("#ClientScontactsID").change(function () {
            $.post("/Forwarding/Forwarding/SelectClientScontacts?ClientScontactsID=" + $("#ClientScontactsID").val(), function (Data) {
                $("#Etrust [name='ClientMobile']").val(Data[0])
            })
        })
        //下拉框改变触发
        $("#ClientSiteID").change(function () {
            $.post("/Forwarding/Forwarding/SelectClientSite?ClientSiteID=" + $("#ClientSiteID").val(), function (Data) {
                if (Data.length==1) {
                    $("#Etrust [name='FactoryName']").val(Data[0].FactoryName)
                    $("#Etrust [name='ClientSite']").val(Data[0].ClientSite)
                    $("#Etrust [name='GatedotName']").val(Data[0].GatedotName)
                    $("#Etrust [name='ContactsName']").val(Data[0].ContactsName)
                    $("#Etrust [name='ContactsPhone']").val(Data[0].ContactsPhone)
                } else {
                    $("#Etrust [name='FactoryName']").val("")
                    $("#Etrust [name='ClientSite']").val("")
                    $("#Etrust [name='GatedotName']").val("")
                    $("#Etrust [name='ContactsName']").val("")
                    $("#Etrust [name='ContactsPhone']").val("")
                }
            })
        })
        //下拉框改变触发
        $("#TiGuiDiDianID").change(function () {
            $.post("/Forwarding/Forwarding/SelectMention?MentionID=" + $("#TiGuiDiDianID").val(), function (Data) {
                if (Data.length == 1) {
                    $("#Etrust [name='T']").val(Data[0].GatedotName)
                    $("#l tbody tr td").eq(2).html(Data[0].Abbreviation)
                    $("#l tbody tr td").eq(3).html(Data[0].GatedotName)
                } else {
                    $("#Etrust [name='T']").val("")
                    $("#l tbody tr td").eq(2).html("")
                    $("#l tbody tr td").eq(3).html("")
                }
            })
        })
        //下拉框改变触发
        $("#HuaiGuiDiDianID").change(function () {
            $.post("/Forwarding/Forwarding/SelectMention?MentionID=" + $("#HuaiGuiDiDianID").val(), function (Data) {
                if (Data.length == 1) {
                    $("#Etrust [name='H']").val(Data[0].GatedotName)
                    $("#l tbody tr td").eq(4).html(Data[0].Abbreviation)
                    $("#l tbody tr td").eq(5).html(Data[0].GatedotName)
                } else {
                    $("#Etrust [name='H']").val("")
                    $("#l tbody tr td").eq(4).html("")
                    $("#l tbody tr td").eq(5).html("")
                }
            })
        })
        //下拉框改变触发
        $("#ShipID").change(function () {
            $.post("/Forwarding/Forwarding/SelectShip?ShipID=" + $("#ShipID").val(), function (Data) {
                if (Data.length == 1) {
                    $("#Etrust [name='Chuangs']").val(Data[0].ChineseName)
                } else {
                    $("#Etrust [name='Chuangs']").val("")
                }
            })
        })
        //layerdate
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '#test1-1'
              , type: 'datetime'
            });
            laydate.render({
                elem: '#test1-2'
              , type: 'datetime'
            });
            laydate.render({
                elem: '#test1-3'
               , type: 'datetime'
            });
            laydate.render({
                elem: '#test1-4'
               , type: 'datetime'
            });
            laydate.render({
                elem: '#test1-5'
              , type: 'datetime'
            });
            laydate.render({
                elem: '#test1-6'
              , type: 'datetime'
            });
            laydate.render({
                elem: '#test1-7'
              , type: 'date'
            });
            laydate.render({
                elem: '#test1-8'
              , type: 'date'
            });
            laydate.render({
                elem: '#test1-9'
              , type: 'datetime'
            });
            laydate.render({
                elem: '#test1-10'
               , type: 'datetime'
            });
            laydate.render({
                elem: '#test1-11'
              , type: 'datetime'
            });
            laydate.render({
                elem: '#test1-12'
              , type: 'datetime'
            });
            laydate.render({
                elem: '#test1-13'
              , type: 'datetime'
            });
            laydate.render({
                elem: '#test1-14'
              , type: 'datetime'
            });
        });
        //生成单号
        $("#Insert").click(function () {
            $("#EtrustNmber").val("EN" + new Date().getTime())
            $("#IndentNumber").val("IN" + new Date().getTime())
            $("#HangCi").val("HC" + new Date().getTime())
            $("#Etrust [name='StaffName']").val($("#tbEtrust tbody tr").eq(0).children().eq(17).html())
            $("#l tbody").remove()
            $("#l").append('<tbody><tr><td style="text-align: center;display:none" class="lineNoWrap"><input class="bsgrid_editgrid_check" type="checkbox" value="true"></td><td style="text-align: center;" class="lineNoWrap"><select type="text" class="layui-input"  name="CabinetType"><option value="">CabinetType</option><option value="20GP">20GP</option><option value="40GP">40GP</option><option value="60GP">60GP</option><option value="80GP">80GP</option><option value="100GP">100GP</option></select></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap">DC' + new Date().getTime() + '</td><td style="text-align: center;" class="lineNoWrap">GH' + new Date().getTime() + '</td><td style="text-align: center;" class="lineNoWrap">FT' + new Date().getTime() + '</td><td style="text-align: center;" class="lineNoWrap">自备柜</td></tr></tbody>')
            $("#Etrust").attr("action", "/Forwarding/Forwarding/InsertEtrust?BookingSpace=" + $("#l tbody td").eq(6).html() + "&Cupboard=" + $("#l tbody td").eq(7).html() + "&Seal=" + $("#l tbody td").eq(8).html())
        })
        //修改
        $("#Update").click(function () {
            var check = $("#tbEtrust input:checked")
            if (check.length == 0) {
                layer.msg("请选择一条委托单", { icon: 6 })
            } else if (check.length > 1) {
                layer.msg("只能一条委托单", { icon: 6 })
            } else if (check.length == 1) {
                if (check.parent().parent().children().eq(15).html() == "已审核") {
                    layer.msg("此委托单已审核", { icon: 6 })
                } if (check.parent().parent().children().eq(15).html() == "未审核" || check.parent().parent().children().eq(15).html() == "审核中") {
                    $.post("/Forwarding/Forwarding/SelectEtrust?Carriage=" + true + "&EtrustID=" + check.parent().parent().children().eq(16).html() + "&Update=" + true, function (Data) {
                        appendOptions("ClientScontactsID", "/Forwarding/Forwarding/ClientScontacts?ClientID=" + Data[0].ClientID, "ClientScontacts")
                        appendOptions("ClientSiteID", "/Forwarding/Forwarding/ClientSite?ClientID=" + Data[0].ClientID, "ClientSite")
                        setTimeout(function () {
                            $("#l tbody").remove()
                            $("#l").append('<tbody><tr><td style="text-align: center;display:none" class="lineNoWrap"><input class="bsgrid_editgrid_check" type="checkbox" value="true"></td><td style="text-align: center;" class="lineNoWrap"><select type="text" class="layui-input"  name="CabinetType"><option value="">CabinetType</option><option value="20GP">20GP</option><option value="40GP">40GP</option><option value="60GP">60GP</option><option value="80GP">80GP</option><option value="100GP">100GP</option></select></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap">自备柜</td></tr></tbody>')
                            loadDatatoForm("Etrust", Data[0])
                            $("#Etrust [name='PlanHandTime']").val(Data[0].planHandTime)
                            $("#Etrust [name='HuiChangTime']").val(Data[0].huiChangTime)
                            $("#Etrust [name='KaiCangTime']").val(Data[0].kaiCangTime)
                            $("#Etrust [name='ArriveTime']").val(Data[0].arriveTime)
                            Clinet = Data[0].ChineseName
                            $("#BasicsInformation").modal('show')
                            $("#Etrust").attr("action", "/Forwarding/Forwarding/UpdateEtrust?EtrustID=" + parseInt(check.parent().parent().children().eq(16).html()))
                            $("#l tbody tr td").eq(2).html(Data[0].TG)
                            $("#l tbody tr td").eq(3).html(Data[0].T)
                            $("#l tbody tr td").eq(4).html(Data[0].HG)
                            $("#l tbody tr td").eq(5).html(Data[0].H)
                            $("#l tbody tr td").eq(6).html(Data[0].BookingSpace)
                            $("#l tbody tr td").eq(7).html(Data[0].Cupboard)
                            $("#l tbody tr td").eq(8).html(Data[0].Seal)
                        }, 800)
                    })
                }
            }
        })
        //客户联系人模态框
        $("#Scontacts").click(function () {
            if ($("#ClientCode").val()>0) {
                $("#InsertClientScontacts [name='Message']").val(Clinet)
                $("#ClientScontacts").modal('show')
            } else {
                layer.msg("请选择客户代码", {icon:6})
            }
        })
        //客户地址
        $("#Factory").click(function () {
            if ($("#ClientCode").val() > 0) {
                $("#InsertClientSite [name='Message']").val(Clinet)
                $("#ClientSite").modal('show')
            } else {
                layer.msg("请选择客户代码", { icon: 6 })
            }
        })
        //新增/修好委托单
        $("#etrust").click(function () {
            if ($("#Etrust [name='WorkCategory']").val() != "" && $("#Etrust [name='WorkCategory']").val() != null && $("#Etrust [name='WorkCategory']").val() != undefined) {
                if ($("#Etrust [name='CargoClassify']").val() != "" && $("#Etrust [name='CargoClassify']").val() != null && $("#Etrust [name='CargoClassify']").val() != undefined) {
                    if ($("#Etrust [name='ClientID']").val() > 0) {
                        if ($("#Etrust [name='ClientScontactsID']").val() > 0) {
                            if ($("#Etrust [name='MessageID']").val() > 0) {
                                if ($("#Etrust [name='ClientSiteID']").val() > 0) {
                                    if ($("#Etrust [name='HuoZhuName']").val() != "" && $("#Etrust [name='HuoZhuName']").val() != null && $("#Etrust [name='HuoZhuName']").val() != undefined) {
                                        if ($("#Etrust [name='TiGuiDiDianID']").val() > 0) {
                                            if ($("#Etrust [name='HuaiGuiDiDianID']").val() > 0) {
                                                if ($("#Etrust [name='ShipID']").val() > 0) {
                                                    if ($("#Etrust [name='PortID']").val() > 0) {
                                                        if ($("#Etrust [name='PlanHandTime']").val() != "" && $("#Etrust [name='PlanHandTime']").val() != null && $("#Etrust [name='PlanHandTime']").val() != undefined) {
                                                            if ($("#Etrust [name='HuiChangTime']").val() != "" && $("#Etrust [name='HuiChangTime']").val() != null && $("#Etrust [name='HuiChangTime']").val() != undefined) {
                                                                if ($("#Etrust [name='KaiCangTime']").val() != "" && $("#Etrust [name='KaiCangTime']").val() != null && $("#Etrust [name='KaiCangTime']").val() != undefined) {
                                                                    if ($("#Etrust [name='ArriveTime']").val() != "" && $("#Etrust [name='ArriveTime']").val() != null && $("#Etrust [name='ArriveTime']").val() != undefined) {
                                                                        if ($("#Etrust [name='CabinetType']").val() != "" && $("#Etrust [name='CabinetType']").val() != null && $("#Etrust [name='CabinetType']").val() != undefined) {
                                                                                $("#Etrust").ajaxSubmit(function (Data) {
                                                                                    if (Data=="新增委托单成功"||Data=="新增委托单成功,无报价") {
                                                                                        Close()
                                                                                        Search()
                                                                                        $("#Insert").click()
                                                                                    }
                                                                                    if (Data == "修改委托单成功" || Data == "修改委托单成功,无报价") {
                                                                                        Close()
                                                                                        $("#BasicsInformation").modal('hide')
                                                                                        Search()
                                                                                    }
                                                                                    layer.msg(Data, { icon: 6 })
                                                                                })
                                                                        } else {
                                                                            layer.msg("请选择柜型", { icon: 6 })
                                                                        }
                                                                    } else {
                                                                        layer.msg("请选择到厂时间", { icon: 6 })
                                                                    }
                                                                } else {
                                                                    layer.msg("请选择开舱时间", { icon: 6 })
                                                                }
                                                            } else {
                                                                layer.msg("请选择回场时间", { icon: 6 })
                                                            }
                                                        } else {
                                                            layer.msg("请选择计划装卸时间", { icon: 6 })
                                                        }
                                                    } else {
                                                        layer.msg("请选择进出口岸", { icon: 6 })
                                                    }
                                                } else {
                                                    layer.msg("请选择船舶", { icon: 6 })
                                                }
                                            } else {
                                                layer.msg("请选择还柜地点", { icon: 6 })
                                            }
                                        } else {
                                            layer.msg("请选择提柜地点", { icon: 6 })
                                        }
                                    } else {
                                        layer.msg("请填写货主名称", { icon: 6 })
                                    }
                                } else {
                                    layer.msg("请选择工厂代码", { icon: 6 })
                                }
                            } else {
                                layer.msg("请选择所属组织", { icon: 6 })
                            }
                        } else {
                            layer.msg("请选择联系人", { icon: 6 })
                        }
                    } else {
                        layer.msg("请选择客户代码", { icon: 6 })
                    }
                } else {
                    layer.msg("请选择货物分类", { icon: 6 })
                }
            } else {
                layer.msg("请选择作业类别",{icon:6})
            }
        })
        //删除委托单
        $("#Delete").click(function () {
            var check = $("#tbEtrust input:checked")
            if (check.length == 0) {
                layer.msg("请选择委托单", { icon: 6 })
            } else if (check.length > 0) {
                var myEtrust = new Array()
                for (var i = 0; i < check.length; i++) {
                    myEtrust[i] = parseInt($("#tbEtrust input:checked").eq(i).parent().parent().children().eq(16).html());
                }
                $("#Etrust").attr("action", "/Forwarding/Forwarding/DeleteEtrust?myEtrust=" + myEtrust)
                $("#Etrust").ajaxSubmit(function (Data) {
                    layer.alert("成功" + Data + "条，失败" + ((check.length) - Data) + "条", {icon:6})
                    Search()
                })
            } 
        })
        //新增客户
        $("#insertclient").click(function () {
            if ($("#InsertClient [name='ClientAbbreviation']").val() != "" && $("#InsertClient [name='ClientAbbreviation']").val() != undefined && $("#InsertClient [name='ClientAbbreviation']").val() != null) {
                if ($("#InsertClient [name='ClientCode']").val() != "" && $("#InsertClient [name='ClientCode']").val() != undefined && $("#InsertClient [name='ClientCode']").val() != null) {
                    if ($("#InsertClient [name='ChineseName']").val() != "" && $("#InsertClient [name='ChineseName']").val() != undefined && $("#InsertClient [name='ChineseName']").val() != null) {
                        $("#InsertClient").ajaxSubmit(function (Data) {
                            if (Data=="新增客户成功") {
                                Close('Client')
                                appendOptions("ClientCode", "/Forwarding/Forwarding/Client?ClientID=" + 1, "ClientCode")
                            }
                            layer.msg(Data, {icon:6})
                        })
                    } else {
                        layer.msg("请填写中文名称", { icon: 6 })
                    }
                } else {
                    layer.msg("请填写客户代码", { icon: 6 })
                }
            } else {
                layer.msg("请填写客户简称", { icon: 6 })
            }
        })
        //新增客户联系人
        $("#insertclientscontacts").click(function () {
            $("#InsertClientScontacts").attr("action", "InsertClientScontacts?ClientID=" + $("#ClientCode").val())
            if ($("#InsertClientScontacts [name='contactsName']").val() != "" && $("#InsertClientScontacts [name='contactsName']").val() != undefined && $("#InsertClientScontacts [name='contactsName']").val() != null) {
                if ($("#InsertClientScontacts [name='contactsPhone']").val() != "" && $("#InsertClientScontacts [name='contactsPhone']").val() != undefined && $("#InsertClientScontacts [name='contactsPhone']").val() != null) {
                    $("#InsertClientScontacts").ajaxSubmit(function (Data) {
                        if (Data == "新增客户联系人成功") {
                            Close('ClientScontacts')
                            $("#InsertClientScontacts [name='Message']").val(Clinet)
                            appendOptions("ClientScontactsID", "/Forwarding/Forwarding/ClientScontacts?ClientID=" + $("#ClientCode").val(), "ClientScontacts")
                        }
                        layer.msg(Data, { icon: 6 })
                    })
                } else {
                    layer.msg("请填写联系人电话", { icon: 6 })
                }
            } else {
                layer.msg("请填写联系人名称", { icon: 6 })
            }
        })
        //新增客户地址
        $("#insertclientsite").click(function () {
            $("#InsertClientSite").attr("action", "InsertClientSite?ClientID=" + $("#ClientCode").val())
            if ($("#InsertClientSite [name='ContactsName']").val() != "" && $("#InsertClientSite [name='ContactsName']").val() != undefined && $("#InsertClientSite [name='ContactsName']").val() != null) {
                if ($("#InsertClientSite [name='ContactsPhone']").val() != "" && $("#InsertClientSite [name='ContactsPhone']").val() != undefined && $("#InsertClientSite [name='ContactsPhone']").val() != null) {
                    if ($("#InsertClientSite [name='FactoryName']").val() != "" && $("#InsertClientSite [name='FactoryName']").val() != undefined && $("#InsertClientSite [name='FactoryName']").val() != null) {
                        if ($("#InsertClientSite [name='FactoryCode']").val() != "" && $("#InsertClientSite [name='FactoryCode']").val() != undefined && $("#InsertClientSite [name='FactoryCode']").val() != null) {
                            if ($("#InsertClientSite [name='Province']").val() != "" && $("#InsertClientSite [name='Province']").val() != undefined && $("#InsertClientSite [name='Province']").val() != null) {
                                if ($("#InsertClientSite [name='CityID']").val() > 0) {
                                    if ($("#InsertClientSite [name='GatedotID']").val() > 0) {
                                        if ($("#InsertClientSite [name='ClientSite']").val() != "" && $("#InsertClientSite [name='ClientSite']").val() != undefined && $("#InsertClientSite [name='ClientSite']").val() != null) {
                                            $("#InsertClientSite").ajaxSubmit(function (Data) {
                                                if (Data == "新增客户地址成功") {
                                                    Close('ClientSite')
                                                    $("#InsertClientSite [name='Message']").val(Clinet)
                                                    appendOptions("ClientSiteID", "/Forwarding/Forwarding/ClientSite?ClientID=" + $("#ClientCode").val(), "ClientSite")
                                                }
                                                layer.msg(Data, { icon: 6 })
                                            })
                                        } else {
                                            layer.msg("请填写详细地址", { icon: 6 })
                                        }
                                    } else {
                                        layer.msg("请选择所属区域", { icon: 6 })
                                    }
                                } else {
                                    layer.msg("请选择所属城市", { icon: 6 })
                                }
                            } else {
                                layer.msg("请选择所属省份", { icon: 6 })
                            }
                        } else {
                            layer.msg("请填写工厂代码", { icon: 6 })
                        }
                    } else {
                        layer.msg("请填写工厂名称", { icon: 6 })
                    }
                } else {
                    layer.msg("请填写联系人电话", { icon: 6 })
                }
            } else {
                layer.msg("请填写联系人名称", { icon: 6 })
            }
        })
        //新增港口
        $("#insertport").click(function () {
            if ($("#InsertPort [name='ChineseName']").val() != "" && $("#InsertPort [name='ChineseName']").val() != undefined && $("#InsertPort [name='ChineseName']").val() != null) {
                if ($("#InsertPort [name='PortCode']").val() != "" && $("#InsertPort [name='PortCode']").val() != undefined && $("#InsertPort [name='PortCode']").val() != null) {
                    $("#InsertPort").ajaxSubmit(function (Data) {
                        if (Data=="新增港口成功") {
                            Close('Port')
                            appendOptions("PortID", "/Forwarding/Forwarding/Port", "Port")
                        }
                        layer.msg(Data, { icon: 6 })
                    })
                } else {
                    layer.msg("请填写港口代码", { icon: 6 })
                }
            } else {
                layer.msg("请填写中文名称", { icon: 6 })
            }
        })
        //派车模态框
        function SendCar() {
            var check = $("#tbCarriage input:checked")
            if (check.length==0) {
                layer.msg("请选择一条委托单", { icon: 6 })
            } else if (check.length > 1) {
                layer.msg("只能一条委托单", { icon: 6 })
            } else if (check.length == 1) {
                if (check.parent().parent().children().eq(3).html() == "运输完成") {
                    layer.msg("此委托单已运输完成", { icon: 6 })
                } else if (check.parent().parent().children().eq(10).html() == "已审核") {
                    layer.msg("此委托单已审核", { icon: 6 })
                } else {
                    $.post("/Forwarding/Forwarding/SelectEtrust?Carriage=" + true + "&EtrustID=" + check.parent().parent().children().eq(11).html() + "&Update=" + true, function (Data) {
                        setTimeout(function () {
                            loadDatatoForm("SendCar", Data[0])
                            if (Data[0].CarriageNumber == null || Data[0].CarriageNumber == undefined || Data[0].CarriageNumber=="") {
                                $("#InsertSendCar [name='CarriageNumber']").val("YS" + new Date().getTime())
                            }
                            if (Data[0].OddNumber == null || Data[0].OddNumber == undefined || Data[0].OddNumber == "") {
                                $("#InsertSendCar [name='OddNumber']").val("PC" + new Date().getTime())
                            }
                            $("#InsertSendCar [name='ArriveTime']").val(Data[0].arriveTime)
                            $("#InsertSendCar [name='PaiCheDate']").val(Data[0].paiCheDate)
                            $("#InsertSendCar").modal('show')
                        }, 800)
                        appendOptions("VehicleInformationID", "/Forwarding/Forwarding/SelectVehicleInformation?UndertakeID=" + Data[0].UndertakeID, "VehicleInformation")
                    })
                }
            }
        }
        //派车
        $("#insertsendcar").click(function () {
            var check = $("#tbCarriage input:checked")
            $("#SendCar").attr("action", "/Forwarding/Forwarding/InsertSendCar?EtrustID=" + parseInt(check.parent().parent().children().eq(11).html()))
            if ($("#SendCar [name='UndertakeID']").val() > 0) {
                if ($("#SendCar [name='PaiCheDate']").val() != "" && $("#SendCar [name='PaiCheDate']").val() != undefined && $("#SendCar [name='PaiCheDate']").val() != null) {
                    $("#SendCar").ajaxSubmit(function (Data) {
                        if (Data == "派车成功" || Data == "派车成功,无报价") {
                            $("#InsertSendCar").modal('hide')
                            Close()
                            Search()
                        }
                        layer.msg(Data, { icon: 6 })
                    })
                } else {
                    layer.msg("请选择派车日期", { icon: 6 })
                }
            } else {
                layer.msg("请选择承运公司", { icon: 6 })
            }
        })
        //跟单模态框
        function Follow() {
            var check = $("#tbCarriage input:checked")
            if (check.length == 0) {
                layer.msg("请选择一条委托单", { icon: 6 })
            } else if (check.length > 1) {
                layer.msg("只能一条委托单", { icon: 6 })
            } else if (check.length == 1) {
                if (check.parent().parent().children().eq(3).html() == "新单") {
                    layer.msg("此委托单未派车", { icon: 6 })
                } else {
                    $.post("/Forwarding/Forwarding/SelectEtrust?Carriage=" + true + "&EtrustID=" + check.parent().parent().children().eq(11).html() + "&Update=" + true, function (Data) {
                        setTimeout(function () {
                            loadDatatoForm("Follow", Data[0])
                            $("#Follow [name='ArriveTime']").val(Data[0].arriveTime)
                            $("#Follow [name='PaiCheDate']").val(Data[0].paiCheDate)
                            $("#InsertFollow").modal('show')
                        }, 800)
                        appendOptions("VehicleInformationIDs", "/Forwarding/Forwarding/SelectVehicleInformation?UndertakeID=" + Data[0].UndertakeID, "VehicleInformation")
                    })
                }
            }
        }
        //跟单
        $("#insertfollow").click(function () {
            var check = $("#tbCarriage input:checked")
            $("#Follow").attr("action", "/Forwarding/Forwarding/InsertFollow?EtrustID=" + parseInt(check.parent().parent().children().eq(11).html()))
            $("#Follow").ajaxSubmit(function (Data) {
                if (Data == "跟单成功") {
                    $("#InsertFollow").modal('hide')
                    Close()
                    Search()
                }
                layer.msg(Data, { icon: 6 })
            })
        })
        //复制
        function Copy() {
            var check = $("#tbEtrust input:checked")
            if (check.length == 0) {
                layer.msg("请选择一条委托单", { icon: 6 })
            } else if (check.length > 1) {
                layer.msg("只能一条委托单", { icon: 6 })
            } else if (check.length == 1) {
                if (check.parent().parent().children().eq(15).html() == "已审核") {
                    layer.msg("此委托单已审核", { icon: 6 })
                } if (check.parent().parent().children().eq(15).html() == "未审核" || check.parent().parent().children().eq(15).html() == "审核中") {
                    $.post("/Forwarding/Forwarding/SelectEtrust?Carriage=" + true + "&EtrustID=" + check.parent().parent().children().eq(16).html() + "&Update=" + true, function (Data) {
                        appendOptions("ClientScontactsID", "/Forwarding/Forwarding/ClientScontacts?ClientID=" + Data[0].ClientID, "ClientScontacts")
                        appendOptions("ClientSiteID", "/Forwarding/Forwarding/ClientSite?ClientID=" + Data[0].ClientID, "ClientSite")
                        setTimeout(function () {
                            $("#l tbody").remove()
                            $("#l").append('<tbody><tr><td style="text-align: center;display:none" class="lineNoWrap"><input class="bsgrid_editgrid_check" type="checkbox" value="true"></td><td style="text-align: center;" class="lineNoWrap"><select type="text" class="layui-input"  name="CabinetType"><option value="">CabinetType</option><option value="20GP">20GP</option><option value="40GP">40GP</option><option value="60GP">60GP</option><option value="80GP">80GP</option><option value="100GP">100GP</option></select></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap"></td><td style="text-align: center;" class="lineNoWrap">DC' + new Date().getTime() + '</td><td style="text-align: center;" class="lineNoWrap">GH' + new Date().getTime() + '</td><td style="text-align: center;" class="lineNoWrap">FT' + new Date().getTime() + '</td><td style="text-align: center;" class="lineNoWrap">自备柜</td></tr></tbody>')
                            $("#Etrust").attr("action", "/Forwarding/Forwarding/InsertEtrust?BookingSpace=" + $("#l tbody td").eq(6).html() + "&Cupboard=" + $("#l tbody td").eq(7).html() + "&Seal=" + $("#l tbody td").eq(8).html())
                            loadDatatoForm("Etrust", Data[0])
                            $("#EtrustNmber").val("EN" + new Date().getTime())
                            $("#IndentNumber").val("IN" + new Date().getTime())
                            $("#HangCi").val("HC" + new Date().getTime())
                            $("#Etrust [name='StaffName']").val($("#tbEtrust tbody tr").eq(0).children().eq(17).html())
                            $("#Etrust [name='PlanHandTime']").val(Data[0].planHandTime)
                            $("#Etrust [name='HuiChangTime']").val(Data[0].huiChangTime)
                            $("#Etrust [name='KaiCangTime']").val(Data[0].kaiCangTime)
                            $("#Etrust [name='ArriveTime']").val(Data[0].arriveTime)
                            Clinet = Data[0].ChineseName
                            $("#BasicsInformation").modal('show')
                            $("#l tbody tr td").eq(2).html(Data[0].TG)
                            $("#l tbody tr td").eq(3).html(Data[0].T)
                            $("#l tbody tr td").eq(4).html(Data[0].HG)
                            $("#l tbody tr td").eq(5).html(Data[0].H)
                            $("#l tbody tr td").eq(6).html(Data[0].BookingSpace)
                            $("#l tbody tr td").eq(7).html(Data[0].Cupboard)
                            $("#l tbody tr td").eq(8).html(Data[0].Seal)
                        }, 800)
                    })
                }
            }
        }
        //应收应付
        function SF() {
            if (!(EtrustID > 0)) {
                layer.msg("请选择一条委托单", { icon: 6 })
            } else if (EtrustID > 0) {
                $.post("/Forwarding/Forwarding/SelectEtrust?Carriage=" + true + "&EtrustID=" + EtrustID + "&Update=" + true, function (Data) {
                        setTimeout(function () {
                            loadDatatoForm("SF", Data[0])
                            $("#SF [name='ArriveTime']").val(Data[0].arriveTime)
                            $("#SF [name='PaiCheDate']").val(Data[0].paiCheDate)
                            $("#InsertSF").modal('show')
                        }, 800)
                        tbExpense.search({ ExpenseID: 0 })
                        appendOptions("VehicleInformationIDl", "/Forwarding/Forwarding/SelectVehicleInformation?UndertakeID=" + Data[0].UndertakeID, "VehicleInformation")
                    })
            }
        }
        //收付表
        function YSF(record, rowIndex) {
            $.post("/Forwarding/Forwarding/chagre?EtrustID=" + EtrustID + "&ExpenseID=" + record.ExpenseID, function (Data) {
                var td = $("#tbExpense tr").eq(rowIndex + 1).children();
                td.eq(4).prepend('&nbsp;&nbsp;&nbsp; <input type="text"  value=' + Data + ' name="FloatSF">&nbsp;&nbsp;&nbsp;');
            })
        }
        //收费
        $("#insertSF").click(function () {
            var myExpense = new Array()
            var myMoney = new Array()
            var mySettleAccounts = new Array()
            var check = $("#tbExpense input[type='checkbox']:checked")
            for (var i = 0; i < check.length; i++) {
                myExpense[i] = check[i].value
                myMoney[i] = $("#tbExpense input[type='checkbox']:checked").eq(i).parent().parent().children().eq(4).children().val();
                mySettleAccounts[i] = $("#tbExpense input[type='checkbox']:checked").eq(i).parent().parent().children().eq(1).html();
            }
            $("#SF").attr("action", "/Forwarding/Forwarding/InsertSF?myExpense=" + myExpense + "&myMoney=" + myMoney + "&EtrustID=" + EtrustID + "&mySettleAccounts=" + mySettleAccounts)
            $("#SF").ajaxSubmit(function (Data) {
                layer.alert("成功" + Data + "条，失败" + ((check.length) - Data) + "条",{icon:6})
                Search()
                Close()
            })
        })
        //审核
        function Audit() {
            var check = $("#tbEtrust input:checked")
            if (check.length == 0) {
                layer.msg("请选择委托单", { icon: 6 })
            } else if (check.length > 0) {
                var myEtrust = new Array()
                for (var i = 0; i < check.length; i++) {
                    myEtrust[i] = parseInt($("#tbEtrust input:checked").eq(i).parent().parent().children().eq(16).html());
                }
                $("#Etrust").attr("action", "/Forwarding/Forwarding/Audit?myEtrust=" + myEtrust)
                $("#Etrust").ajaxSubmit(function (Data) {
                    if (Data == -100000) {
                        layer.alert("此委托单费用项目未明确", { icon: 6 })
                        Search()
                    } else if (Data == -200000) {
                        layer.alert("此委托单已在进行审核", { icon: 6 })
                        Search()
                    } else {
                        layer.alert("成功" + Data + "条，失败" + ((check.length) - Data) + "条", {icon:6})
                    Search()
                    }
                })
            }
        }
        //委托单导出
        function EtrustDerive() {
            layer.confirm("确认要导出委托单吗？", {
                icon: 3,
                btn: ['确定', '取消']
            }, function (layerIndex) {
                layer.close(layerIndex);
                window.open("/Forwarding/Forwarding/SelectEtrust?EtrustNmber="+$("#Search [name='EtrustNmber']").val()+
                                                                    "&Cupboard="+$("#Search [name='Cupboard']").val()+
                                                                    "&Seal="+$("#Search [name='Seal']").val()+
                                                                    "&ArriveTime="+$("#Search [name='ArriveTime']").val()+
                                                                    "&ArriveTimes="+$("#Search [name='ArriveTimes']").val()+
                                                                    "&ClientAbbreviation="+$("#Search [name='ClientAbbreviation']").val()+
                                                                    "&TiGuiDiDianID="+$("#Search [name='TiGuiDiDianID']").val()+
                                                                    "&HuaiGuiDiDianID=" + $("#Search [name='HuaiGuiDiDianID']").val()+
                                                                    "&Carriage="+true+
                                                                    "&EtrustDerive="+true)
            })
        }
        //运输单导出
        function CarriageDerive() {
            layer.confirm("确认要导出运输单吗？", {
                icon: 3,
                btn: ['确定', '取消']
            }, function (layerIndex) {
                layer.close(layerIndex);
                window.open("/Forwarding/Forwarding/SelectEtrust?EtrustNmber=" + $("#Search [name='EtrustNmber']").val() +
                                                                    "&Cupboard=" + $("#Search [name='Cupboard']").val() +
                                                                    "&Seal=" + $("#Search [name='Seal']").val() +
                                                                    "&ArriveTime=" + $("#Search [name='ArriveTime']").val() +
                                                                    "&ArriveTimes=" + $("#Search [name='ArriveTimes']").val() +
                                                                    "&ClientAbbreviation=" + $("#Search [name='ClientAbbreviation']").val() +
                                                                    "&TiGuiDiDianID=" + $("#Search [name='TiGuiDiDianID']").val() +
                                                                    "&HuaiGuiDiDianID=" + $("#Search [name='HuaiGuiDiDianID']").val() +
                                                                    "&Carriage=" + true +
                                                                    "&CarriageDerive=" + true)
            })
        }
        //费用项目导出
        function ChagreDerive() {
            layer.confirm("确认要导出收费项目吗？", {
                icon: 3,
                btn: ['确定', '取消']
            }, function (layerIndex) {
                layer.close(layerIndex);
                window.open("/Forwarding/Forwarding/SelectEtrust?EtrustNmber=" + $("#Search [name='EtrustNmber']").val() +
                                                                    "&Cupboard=" + $("#Search [name='Cupboard']").val() +
                                                                    "&Seal=" + $("#Search [name='Seal']").val() +
                                                                    "&ArriveTime=" + $("#Search [name='ArriveTime']").val() +
                                                                    "&ArriveTimes=" + $("#Search [name='ArriveTimes']").val() +
                                                                    "&ClientAbbreviation=" + $("#Search [name='ClientAbbreviation']").val() +
                                                                    "&TiGuiDiDianID=" + $("#Search [name='TiGuiDiDianID']").val() +
                                                                    "&HuaiGuiDiDianID=" + $("#Search [name='HuaiGuiDiDianID']").val() +
                                                                    "&Carriage=" + false +
                                                                    "&ChagreDerive=" + true)
            })
        }
        //打印报表
        function EtrustPrint() {
            var check = $("#tbCarriage input:checked")
            if (check.length == 0) {
                layer.msg("请选择一条委托单", { icon: 6 })
            } else if (check.length > 0) {
                if (check.parent().parent().children().eq(3).html() != "新单") {
                    layer.confirm("确认要打印运输单报表吗？", {
                        icon: 3,
                        btn: ['确定', '取消']
                    }, function (layerIndex) {
                        layer.close(layerIndex);
                        window.open("/Forwarding/Forwarding/SelectEtrust?EtrustID=" + EtrustID + "&EtrustPrint=" + true+"&Carriage="+true)
                    })
                } else {
                    layer.msg("此委托单未派车", { icon: 6 })
                }
            }
        }
        //打印委托单报表
        function Print() {
            layer.confirm("确认要打印委托单报表吗？", {
                        icon: 3,
                        btn: ['确定', '取消']
                    }, function (layerIndex) {
                        layer.close(layerIndex);
                        window.open("/Forwarding/Forwarding/SelectEtrust?EtrustNmber=" + $("#Search [name='EtrustNmber']").val() +
                                                                    "&Cupboard=" + $("#Search [name='Cupboard']").val() +
                                                                    "&Seal=" + $("#Search [name='Seal']").val() +
                                                                    "&ArriveTime=" + $("#Search [name='ArriveTime']").val() +
                                                                    "&ArriveTimes=" + $("#Search [name='ArriveTimes']").val() +
                                                                    "&ClientAbbreviation=" + $("#Search [name='ClientAbbreviation']").val() +
                                                                    "&TiGuiDiDianID=" + $("#Search [name='TiGuiDiDianID']").val() +
                                                                    "&HuaiGuiDiDianID=" + $("#Search [name='HuaiGuiDiDianID']").val() +
                                                                    "&Carriage=" + true +
                                                                    "&tbetrust=" + true)
                    })
        }
        //打印运输单
        function Prints() {
            if(A>0){
                layer.confirm("确认要打印运输单报表吗？", {
                    icon: 3,
                    btn: ['确定', '取消']
                }, function (layerIndex) {
                    layer.close(layerIndex);
                    window.open("/Forwarding/Forwarding/SelectEtrust?EtrustNmber=" + $("#Search [name='EtrustNmber']").val() +
                                                                "&Cupboard=" + $("#Search [name='Cupboard']").val() +
                                                                "&Seal=" + $("#Search [name='Seal']").val() +
                                                                "&ArriveTime=" + $("#Search [name='ArriveTime']").val() +
                                                                "&ArriveTimes=" + $("#Search [name='ArriveTimes']").val() +
                                                                "&ClientAbbreviation=" + $("#Search [name='ClientAbbreviation']").val() +
                                                                "&TiGuiDiDianID=" + $("#Search [name='TiGuiDiDianID']").val() +
                                                                "&HuaiGuiDiDianID=" + $("#Search [name='HuaiGuiDiDianID']").val() +
                                                                "&A=" + A +
                                                                "&Carriage=" + true +
                                                                "&A1=" + true)
                })
            } else {
                layer.msg("请选择一条数据", { icon: 6 })
            }
        }
        //打印收费单
        function Printn() {
            if (A > 0) {
                layer.confirm("确认要打印收费单报表吗？", {
                    icon: 3,
                    btn: ['确定', '取消']
                }, function (layerIndex) {
                    layer.close(layerIndex);
                    window.open("/Forwarding/Forwarding/SelectEtrust?EtrustNmber=" + $("#Search [name='EtrustNmber']").val() +
                                                                "&Cupboard=" + $("#Search [name='Cupboard']").val() +
                                                                "&Seal=" + $("#Search [name='Seal']").val() +
                                                                "&ArriveTime=" + $("#Search [name='ArriveTime']").val() +
                                                                "&ArriveTimes=" + $("#Search [name='ArriveTimes']").val() +
                                                                "&ClientAbbreviation=" + $("#Search [name='ClientAbbreviation']").val() +
                                                                "&TiGuiDiDianID=" + $("#Search [name='TiGuiDiDianID']").val() +
                                                                "&HuaiGuiDiDianID=" + $("#Search [name='HuaiGuiDiDianID']").val() +
                                                                "&A=" + A +
                                                                "&Carriage=" + false +
                                                                "&A1=" + true)
                })
            } else {
                layer.msg("请选择一条数据", { icon: 6 })
            }
        }
    </script>
    <script>
        //关闭模态框
        function Close(A) {
            if (A == undefined || A == null) {
                $(".modal input").val("")
                $(".modal input[type='checkbox']").prop('checked', false)
                $(" input[type='checkbox']").val(true)
                $(".modal input[type='radio']").prop('checked', false)
                $(".modal select").val(0)
                $(".modal textarea").val("")
                //$("#StaffImage").attr("src", "");
            } else {
                $("#" + A + " input").val("")
                $("#" + A + " input[type='checkbox']").prop('checked', false)
                $("#" + A + " input[type='checkbox']").val(true)
                $("#" + A + " input[type='radio']").prop('checked', false)
                $("#" + A + " select").val(0)
                $("#" + A + " textarea").val("")
                //$("#StaffImage").attr("src", "");
            }
        }
        //联系电话
        function Phone(Event) {
            var phone = /^1[34578]\d{9}$/;
            var Telephone = /^0\d{2,3}-?\d{7,8}$/;
            if (Event.value == "" || Event.value == undefined || Event.value == null) {
                return null;
            } else if (!phone.test(Event.value) && !Telephone.test(Event.value)) {
                Event.value = "";
                layer.msg('您输入的号码不正确，请重新输入', { icon: 0 });
            }
        }
        //浮点数
        function Float(Event, Begin, Finish) {
            var float = /^(-?\d+)(\.\d+)?$/;
            if (Event.value == "" || Event.value == undefined || Event.value == null) {
                return null;
            } else if (!float.test(Event.value)) {
                Event.value = "";
                layer.msg('您输入的数据不正确，请重新输入', { icon: 0 });
            }
            if (Begin > 0 || Finish > 0) {
                if (Begin > Event.value) {
                    Event.value = "";
                    layer.msg('您输入的数据超出范围，请重新输入', { icon: 0 });
                } else
                    if (Finish < Event.value) {
                        Event.value = "";
                        layer.msg('您输入的数据超出范围，请重新输入', { icon: 0 });
                    }
            }
        }
        //只能输入数字
        function Number(Event) {
            var number = /(^\d+$)/;
            if (Event.value == "" || Event.value == undefined || Event.value == null) {
                return null;
            } else if (!number.test(Event.value)) {
                Event.value = "";
                layer.msg('您输入的格式不正确，请重新输入', { icon: 0 });
            }
        }
        //只能输入英文（大写）
        function English(Event) {
            var English = /^[A-Z]+$/
            if (!English.test(Event.value)) {
                layer.msg('您输入的格式不正确，请重新输入', { icon: 0 });
                Event.value = ""
            }
        }
        //只能输入英文（大小写）
        function Englishning(Event) {
            var English = /^[a-zA-Z]+$/
            if (!English.test(Event.value)) {
                layer.msg('您输入的格式不正确，请重新输入', { icon: 0 });
                Event.value = ""
            }
        }
        //姓名
        function Name(Event) {
            var name = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}$/
            if (!name.test(Event.value)) {
                layer.msg('您输入的格式不正确，请重新输入', { icon: 0 });
                Event.value = ""
            }
        }
    </script>
</body>
</html>
